package test;

import cn.hutool.core.date.DateTime;
import org.jeecg.modules.demo.com.kunpeng.mapper.OaAdminLogMapper;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;


@SpringBootTest
public class test {


    @Test
    public void testDate(){
        DateTime dateTime=new DateTime();
        dateTime= DateTime.now();
        System.out.println(dateTime);
    }
    @Test
    public void createProjectId(){
        LocalDate now = LocalDate.now();
        DateTimeFormatter dtf= DateTimeFormatter.ofPattern("yyyy-MM-dd"); //定义时间格式
        String dateStr = now.format(dtf); //转换成String类型
        String[] split = dateStr.split("-");
        for (int i=0;i<split.length;i++){
            System.out.println(split[i].toString());
        }
    }

    @Test
    public void test(){
        String id="";
        String[] fileId=id.split(",");
        String[] fileIds={"22","1","3"};
        for(int i=0;i<fileIds.length;i++){
            boolean isFlag=false;
            for(int j=0;j<fileId.length;j++){
                if(fileId[j].equals(fileIds[i])){
                    isFlag=true;
                }
            }
            if(isFlag==false){
                if(id.equals("")){
                    id=fileIds[i];
                }else {
                    if(!fileIds[i].equals("")) {
                        id = id + "," + fileIds[i];
                    }
                }
            }
        }
        System.out.println(id);
    }

    @Test
    public void test1(){
        List<Integer> list=new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        for(Integer num:list){
            if(num%2==0){

            }
        }

        Iterator<Integer> iterator=list.iterator();
        while (iterator.hasNext()){
            Integer num = iterator.next();
            if(num%2==0){
                iterator.remove();
            }
        }

        for(Integer i:list){
            System.out.println("删除后的集合："+i.toString());
        }

    }
}
